﻿// Tierless
// Copyright © 2010 Alphora
// This file is licensed under a modified BSD-license (see tierless_license.txt).

using System;
using System.Collections.Generic;
using System.ServiceModel;
using Tierless.Framework.Data;
using Tierless.Framework.EntityTypes;

namespace Tierless.Framework.ServiceContracts
{
	[ServiceContract(Namespace = "http://Tierless.Framework.ServiceContracts/2010/08", Name = "IEntityService", ConfigurationName = "Tierless.Framework.ServiceContracts.IEntityService")]
	public interface IAsyncEntityService
	{
		[FaultContract(typeof(TierlessFault))]
		#if !SILVERLIGHT
		[ReferencePreservingDataContractFormat(true)]
		#endif
		[OperationContract(IsOneWay = false, AsyncPattern = true, Action = "Get")]
		IAsyncResult BeginGet(EntityRequests lookupRequest, AsyncCallback callback, object state);
		List<EntitySet> EndGet(IAsyncResult result);

		[FaultContract(typeof(TierlessFault))]
		#if !SILVERLIGHT
		[ReferencePreservingDataContractFormat(true)]
		#endif
		[OperationContract(IsOneWay = false, AsyncPattern = true, Action = "Save")]
		IAsyncResult BeginSave(List<EntitySet> entitySets, AsyncCallback callback, object state);
		EntitySaveResult EndSave(IAsyncResult result);

		[FaultContract(typeof(TierlessFault))]
		#if !SILVERLIGHT
		[ReferencePreservingDataContractFormat(true)]
		#endif
		[OperationContract(IsOneWay = false, AsyncPattern = true, Action = "Describe")]
		IAsyncResult BeginDescribe(string[] entityNames, AsyncCallback callback, object state);
		EntityType[] EndDescribe(IAsyncResult result);
	}
}